package hc.bre.data.strategy

import hc.bre.ComponentConfig
import hc.bre.cmn.RuleScriptBuilder
import hc.bre.cmn.IDetailList
import hc.bre.cmn.RuleDefinition

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true, includePackage = false)
class StrategyDefinition extends RuleDefinition implements IDetailList<StrategyOption>{
	public static final ComponentConfig _config ;
	static {
		_config = new ComponentConfig();
		_config.rtype = 'data:strategy';
		_config.rname = '策略数据定义';
		_config.builderClass = StrategyBuilder;
		_config.resultStruct = new StrategyStruct();
		_config.objectpage = '/rule/strategyeditor.htm?rpath=${rpath}';
		_config.description = '''
策略表是对一系列决策选项的记录，每一个选项由相同结果的变量表示。
例如一个授信决策包括最长最短周期、最大最小金额、最高最低利率等内容。
决策表就是针对不同情景的决策结果候选项构成的表，一个选项由一组变量的值构成。
''';
	}

	int valuemaxid = 100;	//preserve some number for other result structure
	List<StrategyValueDef> valueDefList=[];
	List<StrategyOption> list=[];

	@Override
	public StrategyDefinition load(Map map) {
		super.load(map);

		valuemaxid = map['valuemaxid'] as Integer
		valueDefList = hc.Util.loadList(map['valueDefList'], StrategyValueDef.class);
		list = hc.Util.loadList(map['list'], StrategyOption.class);

		return this;
	}

//	@Override
//	public <T extends RuleScriptBuilder> Class<T> scriptBuilderClass() {
//		return StrategyBuilder.class;
//	}
}
